<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>样式绑定</title>
    <style>
        .red {
            color: red;
        }

        .yellow {
            background: rgb(0, 225, 255)
        }

        .fsize {
            font-size: 50px;
        }
    </style>
</head>

<body>
    <div id="app">

    </div>
</body>
<script src="https://unpkg.com/vue@next"></script>
<script>
    const app = Vue.createApp({
        data() {
            return {
                message: 'hello world',
                classString: 'fsize red yellow',
                classObject: { red: false, yellow: true, fsize: true },
                classArray: ['red', 'yellow', { fsize: false }],
                ss: 'background:yellow',
                so: { color: 'red', background: 'yellow' }
            }
        },
        template: `
    <div class='red yellow fsize'>hello world</div>
    <div :class='classString'>classString Vue.js</div>
    <div :class='classObject'>classObject</div>
    <div :class='classArray'>classArray</div>
    <div :class='ss'>ss</div>
    ------------------------
    <div style='color:red;font-size: 50px;'>helloworld</div>
    <div :style='classString'>helloworld</div>
    <div :style='classObject'>helloworld</div>
    `

    })
    app.component('demo', {
        template: `
    <div :class='$attrs.class'>demo1</div>
    <div :class='$attrs.class'>demo2</div>
    `
    });
    const vm = app.mount("#app");

</script>

</html>